﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using KerriganMobile.MobileServiceWCF;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using System.Windows.Data;

namespace KerriganMobile.Models
{
    public class ApplicationManager
    {
        public static int ID_CURRENT_CUSTOMER;

        public static int ID_CURRENT_INSTRUCTOR;

        public static int ID_CURRENT_SESSION;

        public static MobileServiceClient client = new MobileServiceClient();

        public static void changeURI(PhoneApplicationPage page, string uri)
        {
            page.NavigationService.Navigate(new Uri("/Views/" + uri + ".xaml", UriKind.Relative));
            
        }



    }

    public class DateToHourConverter : IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string result = "undefined";
            if (value != null)
            {
                DateTime b = (DateTime)value;
                string hour  = b.Hour.ToString();
                string minute = b.Minute.ToString();
                if (b.Hour < 10)
                {
                    hour = "0" + hour;
                }

                if (b.Minute < 10)
                {
                    minute = "0" + minute;
                }

                result = hour + ":" + minute;
            }
            return result;

        }



        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {

            return value;

        }

    }



}
